// import { ClassfootEntity } from './classtify';
import { ClassfootEntity } from './classtify';
import { xsEntity } from './commentity';
import { Column, Entity, ManyToOne, OneToMany } from 'typeorm';
import { ShopEntity } from './shop';
import { spuitemEntity } from './spu';

/**
 * 描述
 */
@Entity()
// extends xsEntity   继承了  xsEntity 这个类 默认添加了id  创建时间 更新时间
export class FoodEntity extends xsEntity {
    @Column({ comment: '食品图片' })
    url: string;
    @Column({ comment: '食品图片' })
    des: string;
    @Column({ comment: '被搜索的关键词' })
    keyword: string;
    @Column({ comment: '食品价格', scale: 2 })
    price: number;
    @Column({ comment: '食品价格', default: null })
    stock: number;


    @OneToMany(() => spuitemEntity, photo => photo.Pid)
    spu: spuitemEntity[];



    @Column({ comment: '销量' })
    sellnum: number;

    //  一个食物, 只能对应第一个分类
    // ManyToOne   数据库都是孩子 , 但是孩子们只能有父亲  多对一 
    @ManyToOne(a => ClassfootEntity, c => c.foods)
    Pid: ClassfootEntity
    @ManyToOne(a => ShopEntity, c => c.shopfoods)
    shopPid: ShopEntity





}
